Skip to content

Develop#12

Merged
walmir-silva merged 2 commits intomainfrom
develop
Mar 2, 2026
Merged

Develop#12
walmir-silva merged 2 commits intomainfrom
develop

Conversation

@walmir-silva
Copy link
Copy Markdown
Contributor

No description provided.

PHPUnit 12.5.x is stricter about coverage attribution:
- Tests that touch classes not listed in CoversClass/UsesClass are marked
  risky or produce 'not a valid target' warnings with --coverage.

ToolExceptionTest:        #[UsesClass(DevkitException::class)]
  ToolException extends DevkitException — parent is touched implicitly.

ConfigurationExceptionTest: #[UsesClass(DevkitException::class)]
  Same reason.

QualityReportTest:         #[UsesClass(ToolResult::class)]
  QualityReport helper creates ToolResult instances directly.
Brings test base from 9% (3/33 classes) towards complete coverage.

New test files (12 files / 117 added tests):
  tests/Unit/Configuration/
    - PhpUnitConfigGeneratorTest (7 tests)
    - PhpStanConfigGeneratorTest (7 tests)
    - CsFixerConfigGeneratorTest (8 tests)
    - PsalmConfigGeneratorTest   (7 tests)
    - RectorConfigGeneratorTest  (7 tests)
  tests/Unit/Core/
    - MigrationDetectorTest      (7 tests — real filesystem)
    - ProcessExecutorTest        (11 tests)
    - DevkitTest                 (17 tests — init/clean/quality/gitignore)
    - ProjectDetectorTest        (10 tests)
  tests/Unit/Command/
    - AbstractCommandTest        (17 tests — arg helpers + output helpers)
  tests/Unit/Runner/
    - RunnersTest                (20 tests — all 6 runners + AbstractToolRunner)
  tests/Unit/Exception/  (updated: added UsesClass)
    - ToolExceptionTest
    - ConfigurationExceptionTest
  tests/Unit/ValueObject/ (updated: added UsesClass)
    - QualityReportTest

Coverage strategy:
  - Config generators: assert generated string content
  - MigrationDetector: real tmpdir filesystem
  - ProcessExecutor: real php -r commands
  - Devkit: mock ConfigGenerator/ToolRunner via createMock()
  - Runners: real ProcessExecutor + vendor binaries (available in devenv)
  - AbstractToolRunner: anonymous class for binary-not-found path (exit 127)
  - AbstractCommand: anonymous subclass for argument helpers;
    expectNotToPerformAssertions() for fwrite(STDOUT/STDERR) helpers
    (fwrite bypasses ob_start output buffering)
@walmir-silva walmir-silva merged commit 4f711dd into main Mar 2, 2026
10 of 12 checks passed
walmir-silva added a commit that referenced this pull request Mar 2, 2026
KcodeComposerGeneratorTest (5 cases): toolName, outputPath, default versions,
user version overrides, config section, output newline.

bin/build-phar.php: restored to lean build strategy — bundles only src/
and an inline PSR-4 autoloader. Tools install dynamically via kcode init,
avoiding prohibitively slow Phar::compressFiles(GZ) on large vendor trees
(documented pitfall #12 in devkit KI).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant